export default {
  namespaced:true,
  state:{
    name:'张三',
    age:18
  },
  mutations:{
    setUser(state,newName){
      state.name = newName
    }
  },
  getters:{
    isAge(state){
      return state.age >= 18 ? '成年' : '未成年'
    }
  },
  actions:{
    setNameAsync(context,newName){
      setTimeout(() => {
        context.commit('setUser',newName)
      },2000);
    }
  },
}
